<?php
include('../../include/functions.inc.php');
include('../../include/inputbuilder.inc.php');
include('../../include/maintenance.inc.php');

$mTeacher = unserialize($_SESSION['mTeacher']);

$builder = new InputBuilder();
$builder->db = $db;

$tabs = $db->query_select('cllg_table_tab', "TABLE_NAME='cllg_teacher'");
?>

<form id="<?php echo $mTeacher->formName; ?>" name="<?php echo $mTeacher->formName; ?>" method="GET" action="<?php echo $mTeacher->saveNewUrlPage; ?>">
    <div id="panel" class="">
        <ul class="nav nav-tabs">
            <?php
            $ix = 0;
            foreach ($tabs as $t) {
                $ix++;
                ?>
                <li class="active" style="font-weight:bolder" tabindex="<?php echo $ix; ?>"><a><?php echo $t["CAPTION"]; ?></a></li>
            <?php } ?>
        </ul>
        <div class="">
            <?php
            $ix = 0;
            foreach ($tabs as $t) {
                $ix = $t["ID"];
                ?>
                <div id="<?php echo $ix; ?>"  class="">

                    <table class=""  width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <th scope="col">
                                <div class="btn-group" style="margin-left:60%">
                                    <input type="button" class="btn btn-info" name="<?php echo $ix; ?>cmdOk" id="cmdOk<?php echo $ix; ?>" value="Guardar" 
                                       onClick="javascript:formOkBt($(this.form),newAction);jQuery('#cmAddcontainer').show();" />   
                                    <input type="button" name="<?php echo $ix; ?>cmdCancel" id="<?php echo $ix; ?>cmdCancel" class="btn btn-info" value="Cancelar" onClick="loadTable();jQuery('#cmAddcontainer').show();" />      
                                </div>    
                            </th>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <br/><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <?php
                                    if ($ix == 5) {
                                        //solo filas
                                        ?>  



                                        <tr>
                                            <td>* Identificaci&oacute;n</td>
                                            <td><input name="ID" type="text" id="ID" />          </td>
                                        </tr>
                                        <tr>
                                            <td width="25%">* Nombres</td>
                                            <td width="75%">
                                                <input name="FIRST_NAME" type="text" value="" id="FIRST_NAME" size="50" maxlength="100" />
                                                <label></label></td>
                                        </tr>
                                        <tr>
                                            <td>* Apellidos</td>
                                            <td>
                                                <input name="LAST_NAME"  type="text" id="LAST_NAME" size="50" maxlength="100" />            </td>
                                        </tr>
                                        <tr>
                                            <td>Sexo</td>
                                            <td>            <select name="GENDER" size="1" id="GENDER">
                                                    <option value="M">Masculino</option>
                                                    <option value="F">Femenino</option>
                                                </select>          </td>
                                        </tr>
                                        <tr>
                                            <td> Fecha de Nacimiento</td>
                                            <td>          

                                                <input name="BIRTH_DATE" type="text" id="BIRTH_DATE" />
                                                <input name="STATUS" type="hidden" id="STATUS" value="1" /></td>
                                        </tr>
                                        <tr>
                                            <td>Edad</td>
                                            <td><h3><div id="edad"></div></h3></td>
                                        </tr>
                                    <?php } ?>
                                    <?php
                                    $builder->build("cllg_teacher", NULL, $t['ID']);
                                    ?>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">&nbsp;</td>
                        </tr>
                    </table>
                </div>
            <?php } ?> 

        </div>
    </div>
    <script type="text/javascript">
  
        $("#cmAddcontainer").hide();
        alert("Has loaded!");
    
</script>
</form>
<?php
$_SESSION['fields'] = serialize($builder->fieldsArray);
?>